package com.yjht.common.result;

import com.baomidou.mybatisplus.plugins.Page;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * EasyUI Page返回
 *
 * @author lengleng
 */
@Getter
@Setter
public class EasyPage<T> {

	/**
	 * 总记录
 	 */
	private long total;
	/**
	 * 显示的记录
	 */
	private List<T> rows;

	public EasyPage() {}

	private EasyPage(Page<T> page) {
		this.rows = page.getRecords();
		this.total = page.getTotal();
	}

	public static <T> EasyPage<T> of(Page<T> page) {
		return new EasyPage(page);
	}

}
